<template>
  <div class="printForm">
    <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div>
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('申请标题') }}</td>
        <td colspan="3">{{ form.actTitle }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('姓名') }}</td>
        <td>
          {{ form.user.nickName }}
        </td>
        <td class="tit">{{ $t('级别') }}</td>
        <td>
          <el-select v-model="form.level" :placeholder="$t('级别')">
            <el-option
              v-for="dict in levelOptions"
              :key="dict.dictValue"
              :label="$t(dict.dictLabel)"
              :value="dict.dictValue"
            />
          </el-select>
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('外派时间') }}</td>
        <td>
          {{ parseTime(form.expatsTime) }}
        </td>
        <td class="tit">{{ $t('外派地点') }}</td>
        <td>
          {{ form.expatsAddress }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('说明') }}</td>
        <td colspan="3">
          {{ form.explain }}
        </td>
      </tr>
    </table>

    <FileView :list.sync="form.fileList" data-type="deal_expats" :business-id="autoBusinessId($route.query.id, form)" :btn-show="!otherBtnHide" />

  </div>
</template>

<script>
    import { getDealExpats } from '@/api/deal/expats/dealExpats'

    export default {
        data() {
            return {
                // 是否隐藏保存按钮
                btnHide: false,
                // 是否隐藏其他按钮
                otherBtnHide: false,
                // 级别 字典deal_level_type字典
                levelOptions: [], // 表单参数
                form: {
                  fileList: [],
                  user: {
                    userId: undefined
                  }
                },
                // 遮罩层
                loading: false,
                // 操作按钮默认不展示
                buttonShow: true
            }
        },
        created() {
            this.getDicts('deal_level_type').then(response => {
                this.levelOptions = response.data
            })
            this.$bus.$emit('async_done')
        },
        methods: {
            // 初始化数据
            init(data) {
              this.loading = true
                if (data != null && data.id !== undefined) {
                    getDealExpats(data.id).then(response => {
                        this.form = response.data
                      this.loading = false
                    })
                }
            }

        }

    }
</script>
